/*
timerInterrupt_match.pde -- CTC match irq test
Copyright (c) 2010 Ed Bennett.  All rights reserved. 

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


// timers act directly on pins --first example with fixed speeds
//
// Three LED's blinking together at different rates.
// Three timer channels are used. The channels are 
// numbered 0, 1, and 2. 
//
// Timer commands usually take a channel number and/or a 
// time-value. 
//
// The unit of time is is called a blink. The duration 
// of a blink is related to an AVR jiffy. See
// http://en.wikipedia.org/wiki/Jiffy_%28time%29
//
// This example uses direct control of the pins from the timer channels.
// This method uses less processor power than callbacks or flag polling.
// (see the other examples)
//
// There are 16 timer channels numbered 0-15
//


#include <TimerScheduler.h>


// hardware pins
int LED0 = 13;
int LED1 = 12;
int LED2 = 11;
int LED3 = 10;

int outval0 = 0;
int outval1 = 0;
int outval2 = 0;


void setup()
{   
  pinMode(LED0, OUTPUT); 
  pinMode(LED1, OUTPUT); 
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);

  Timer.begin();        // start the hardware timer
  
  // attach LED pins to timer channels
  Timer.attachPin(0, LED0); // (channel, value)
  Timer.attachPin(1, LED1);
  Timer.attachPin(2, LED2); 

  
  // using pin-direct mode, you need to set the pin-high
  // and pin-low times seperately
  // 
  Timer.setHighTime(0, 1); // (channel, value)
  Timer.setLowTime(0, 1); 
  
  Timer.setHighTime(1, 1);
  Timer.setLowTime(1, 1);
  
  Timer.setHighTime(2,1);
  Timer.setLowTime(2, 1);
  
  
  
  
  Timer.start(0);       // (channel)
  Timer.start(1); 
  Timer.start(2); 
   Serial.begin(9600);
}


// You can put things in loop(), if you like,
// but it's not required.

void loop()
{
  //Serial.print("How! High are you? ");
  //digitalWrite(LED3,HIGH);
  //delay(500);
 // digitalWrite(LED3,LOW);
 // delay(500);
  
 
}
